package com.model;

import com.jfinal.plugin.activerecord.Model;

import java.util.List;

/**
 * Created by chaiyuan on 2017/5/6.
 */
public class Project extends Model<Project> {

    public static final Project dao = new Project();

    public Teacher getTeacher() {

        return Teacher.dao.findById(get("tea_id"));
    }
    public List<Student> getStudents(){
        return Student.dao.find("select stu.* from Student stu inner join user_project  up on stu.stu_id = up.student_id where up.project_id = "+get("id"));
    }
    public Student getStudent(){
        return Student.dao.findFirst("select *  from student where project_id = ?",get("id"));
    }
}
